package rent.hj.videoplayer;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import rent.hj.videoplayer.R;

/**
 * Created by wangjianqiang on 2016/7/25.
 */
public class EpisodeAdapter extends BaseAdapter {
    private Context mContext;
    private List<String> strings = new ArrayList<>();

    public EpisodeAdapter(Context context) {
        super();
        this.mContext = context;
    }

    public void setList(List<String> list) {
        this.strings = list == null ? new ArrayList<String>() : list;
    }

    public List<String> getList() {
        return strings;
    }

    @Override
    public int getCount() {
        return strings.size();
    }

    @Override
    public String getItem(int position) {
        return strings.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.video_play_episode_item_layout, null);
        TextView episode_tv = (TextView) convertView.findViewById(R.id.video_play_episode_tv);
        episode_tv.setText("第" + strings.get(position) + "集");
        return convertView;
    }
}
